home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / Moving.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-07  |  9.1 KB  |  273 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Animated Data Example"
  5.    ClientHeight    =   5340
  6.    ClientLeft      =   1380
  7.    ClientTop       =   4350
  8.    ClientWidth     =   7995
  9.    Height          =   5745
  10.    Left            =   1320
  11.    LinkTopic       =   "Form1"
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   5340
  15.    ScaleWidth      =   7995
  16.    Top             =   4005
  17.    Width           =   8115
  18.    Begin Threed.SSPanel pnlControls 
  19.       Height          =   5175
  20.       Left            =   6000
  21.       TabIndex        =   1
  22.       Top             =   120
  23.       Width           =   1815
  24.       _Version        =   65536
  25.       _ExtentX        =   3201
  26.       _ExtentY        =   9128
  27.       _StockProps     =   15
  28.       BackColor       =   12632256
  29.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  30.          Name            =   "MS Sans Serif"
  31.          Size            =   8.25
  32.          Charset         =   0
  33.          Weight          =   400
  34.          Underline       =   0   'False
  35.          Italic          =   0   'False
  36.          Strikethrough   =   0   'False
  37.       EndProperty
  38.       BevelOuter      =   1
  39.       Begin VB.Frame fraChartType 
  40.          Caption         =   " Chart Type "
  41.          Height          =   2595
  42.          Left            =   180
  43.          TabIndex        =   4
  44.          Top             =   240
  45.          Width           =   1455
  46.          Begin VB.OptionButton optChartType 
  47.             Caption         =   "Polar"
  48.             Height          =   195
  49.             Index           =   5
  50.             Left            =   240
  51.             TabIndex        =   11
  52.             Top             =   1860
  53.             Width           =   1095
  54.          End
  55.          Begin VB.OptionButton optChartType 
  56.             Caption         =   "Radar"
  57.             Height          =   195
  58.             Index           =   4
  59.             Left            =   240
  60.             TabIndex        =   10
  61.             Top             =   1560
  62.             Width           =   1095
  63.          End
  64.          Begin VB.OptionButton optChartType 
  65.             Caption         =   "3 D Bar"
  66.             Height          =   195
  67.             Index           =   3
  68.             Left            =   240
  69.             TabIndex        =   9
  70.             Top             =   1260
  71.             Width           =   1095
  72.          End
  73.          Begin VB.OptionButton optChartType 
  74.             Caption         =   "2 D Bar"
  75.             Height          =   195
  76.             Index           =   2
  77.             Left            =   240
  78.             TabIndex        =   8
  79.             Top             =   960
  80.             Width           =   1095
  81.          End
  82.          Begin VB.OptionButton optChartType 
  83.             Caption         =   "3 D Line"
  84.             Height          =   195
  85.             Index           =   1
  86.             Left            =   240
  87.             TabIndex        =   7
  88.             Top             =   660
  89.             Width           =   1095
  90.          End
  91.          Begin VB.OptionButton optChartType 
  92.             Caption         =   "2 D Line"
  93.             Height          =   195
  94.             Index           =   0
  95.             Left            =   240
  96.             TabIndex        =   6
  97.             Top             =   360
  98.             Value           =   -1  'True
  99.             Width           =   1095
  100.          End
  101.          Begin VB.OptionButton optChartType 
  102.             Caption         =   "Surface"
  103.             Height          =   195
  104.             Index           =   6
  105.             Left            =   240
  106.             TabIndex        =   5
  107.             Top             =   2160
  108.             Width           =   1095
  109.          End
  110.       End
  111.       Begin VB.CommandButton cmdStop 
  112.          Caption         =   "Stop"
  113.          Height          =   495
  114.          Left            =   300
  115.          TabIndex        =   3
  116.          Top             =   4440
  117.          Width           =   1215
  118.       End
  119.       Begin VB.CommandButton Command1 
  120.          Caption         =   "Start"
  121.          Height          =   495
  122.          Left            =   300
  123.          TabIndex        =   2
  124.          Top             =   3840
  125.          Width           =   1215
  126.       End
  127.    End
  128.    Begin VtChartLib.VtChart VtChart1 
  129.       Height          =   5055
  130.       Left            =   120
  131.       TabIndex        =   0
  132.       Top             =   120
  133.       Width           =   5415
  134.       _ExtentX        =   9551
  135.       _ExtentY        =   8916
  136.       _0              =   $"Moving.frx":0000
  137.       _1              =   $"Moving.frx":0405
  138.       _2              =   $"Moving.frx":080B
  139.       _3              =   $"Moving.frx":0C10
  140.       _4              =   $"Moving.frx":1016
  141.       _5              =   $"Moving.frx":141B
  142.       _6              =   $"Moving.frx":1820
  143.       _7              =   $"Moving.frx":1C25
  144.       _8              =   $"Moving.frx":202A
  145.       _9              =   $"Moving.frx":242F
  146.       _10             =   $"Moving.frx":2836
  147.       _11             =   $"Moving.frx":2C3B
  148.       _12             =   $"Moving.frx":3040
  149.       _13             =   $"Moving.frx":3445
  150.       _count          =   14
  151.       _ver            =   1
  152.    End
  153. Attribute VB_Name = "Form1"
  154. Attribute VB_Creatable = False
  155. Attribute VB_Exposed = False
  156. Option Explicit
  157. Dim run As Boolean
  158. Dim gChartType%, gRows%, gCols%
  159. Private Sub cmdStop_Click()
  160.    run = False
  161. End Sub
  162. Private Sub Command1_Click()
  163.    Const AngleIncrement = 0.2
  164.    Const PI = 3.14159264
  165.    Static DataAngle#, aMin#
  166.    MousePointer = 11 '              ' Wait cursor
  167.    run = True
  168.    While run
  169.       '' Move existing data to the left
  170.       VtChart1.DataGrid.MoveData 1, 1, gRows - 1, gCols, 0, 1
  171.       
  172.       DataAngle = DataAngle + AngleIncrement
  173.       aMin = (DataAngle / PI) - 1
  174.       If (aMin < 0) Then aMin = 0
  175.             
  176.       Select Case gChartType
  177.          Case VtChChartType2dXY
  178.             With VtChart1.DataGrid
  179.                .SetData 1, 1, DataAngle / PI, False
  180.                .SetData 1, 2, Sin(DataAngle), False
  181.                .SetData 1, 3, DataAngle / PI, False
  182.                .SetData 1, 4, Sin(DataAngle + PI / 2), False
  183.                .SetData 1, 5, DataAngle / PI, False
  184.                .SetData 1, 6, Sin(DataAngle - PI / 2), False
  185.             End With
  186.             
  187.          Case VtChChartType3dLine, VtChChartType2dBar, VtChChartType3dBar, VtChChartType2dRadar
  188.             With VtChart1.DataGrid
  189.                .SetData 1, 3, Sin(DataAngle + PI / 2), False
  190.                .SetData 1, 2, Sin(DataAngle), False
  191.                .SetData 1, 1, Sin(DataAngle - PI / 2), False
  192.              End With
  193.          
  194.          Case VtChChartType2dPolar
  195.             With VtChart1.DataGrid
  196.                .SetData 1, 1, (DataAngle * 30), False
  197.                .SetData 1, 2, Cos(DataAngle), False
  198.                .SetData 1, 3, (DataAngle * 50), False
  199.                .SetData 1, 4, Cos(DataAngle), False
  200.                .SetData 1, 5, (DataAngle * 10), False
  201.                .SetData 1, 6, Cos(DataAngle), False
  202.              End With
  203.          
  204.          Case VtChChartType3dSurface
  205.             With VtChart1.DataGrid
  206.                .SetData 1, 1, Sin(DataAngle), False
  207.                .SetData 1, 2, Sin(DataAngle + AngleIncrement), False
  208.                .SetData 1, 3, Sin(DataAngle + AngleIncrement * 2), False
  209.                .SetData 1, 4, Sin(DataAngle + AngleIncrement * 3), False
  210.                .SetData 1, 5, Sin(DataAngle + AngleIncrement * 4), False
  211.              End With
  212.          
  213.       End Select
  214.       
  215.       VtChart1.Plot.Axis(VtChAxisIdX).ValueScale.Maximum = aMin + 1
  216.       VtChart1.Plot.Axis(VtChAxisIdX).ValueScale.Minimum = aMin
  217.       
  218.       DoEvents
  219.    Wend
  220.    MousePointer = 0 ' default cursor
  221. End Sub
  222. Private Sub Form_Load()
  223.    VtChart1.DrawMode = VtChDrawModeBlit
  224.    Call optChartType_Click(0)
  225.    run = False
  226. End Sub
  227. Private Sub Form_Resize()
  228.    VtChart1.Repaint = False
  229.    pnlControls.Left = ScaleWidth - pnlControls.Width - 60
  230.    pnlControls.Height = ScaleHeight - 120
  231.    VtChart1.Width = pnlControls.Left - 150
  232.    VtChart1.Height = ScaleHeight - 120
  233.    VtChart1.Repaint = True
  234. End Sub
  235. Private Sub optChartType_Click(Index As Integer)
  236.    Select Case Index
  237.       Case 0
  238.          gChartType = VtChChartType2dXY
  239.          gRows = 18
  240.          gCols = 6
  241.       Case 1
  242.          gChartType = VtChChartType3dLine
  243.          gRows = 18
  244.          gCols = 3
  245.       Case 2
  246.          gChartType = VtChChartType2dBar
  247.          gRows = 18
  248.          gCols = 3
  249.       Case 3
  250.          gChartType = VtChChartType3dBar
  251.          gRows = 18
  252.          gCols = 3
  253.       Case 4
  254.          gChartType = VtChChartType2dRadar
  255.          gRows = 18
  256.          gCols = 3
  257.       Case 5
  258.          gChartType = VtChChartType2dPolar
  259.          gRows = 18
  260.          gCols = 6
  261.       Case 6
  262.          gChartType = VtChChartType3dSurface
  263.          gRows = 5
  264.          gCols = 5
  265.       Case Else
  266.          MsgBox "Chart type not available"
  267.          Call optChartType_Click(0)
  268.    End Select
  269.          
  270.    SetChartTypeAndSize VtChart1, gChartType, gRows, gCols
  271.    ZeroGrid VtChart1
  272. End Sub
  273.